package com.sy.workflow.service;


import java.util.concurrent.atomic.AtomicBoolean;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
public class SpringOnloadListener   implements ApplicationListener<ContextRefreshedEvent>{
	
	//初始化标志
	private static AtomicBoolean initFlag = new AtomicBoolean(false);
	
	
	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
		
		log.info("系统初始化start...");
		
		//已经初始化 , 则不再初始化
		if(!initFlag.compareAndSet(false , true))
			return;
		
		log.info("系统初始化end...");
		
	}

}
